<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="javax.jdo.Query" %>
<%@ page import="appnode.Node" %>
<%@ page import="appnode.Ratings" %>
<%@ page import="appnode.RateUtils" %>
<%@ page import="appnode.SearchNode" %>
<%@ page import="appnode.Link" %>
<%@ page import="appnode.Linktools" %>
<%@ page import="appnode.Interface" %>
<%@ page import="appnode.NodeRating" %>
<%@ page import="appnode.PMF" %>
<%@ page import="com.google.appengine.api.datastore.Key"%>
<%@ page import="com.google.appengine.api.datastore.KeyFactory;"%>

<html>
<head>
	<link rel="stylesheet" href="map.css" type="text/css" media="screen" title="mapcss"></link>
	<title>
		Edit interface
	</title>
	<script>
	//document.input.Name.value==""

	function checkform() {
		valid=true;
		if (document.input.name.value==""){
			alert("Fill all fields");
			valid=false;	
		}
	return valid;
	}
	</script>
	
	
</head>
<body class="window">
<%
	PersistenceManager pm = PMF.get().getPersistenceManager();
	String keystrif = request.getParameter("keystrif");
	Key key = KeyFactory.stringToKey(keystrif);
	Interface interfc = pm.getObjectById(Interface.class,key);
	

%>
<div class="openwindow">
Your interface (<a href="javascript:load()">delete</a>)<p>
<form name="input" action="editinterface" method="get" onsubmit="return checkform()">
<input type="hidden" name="keystrif" value="<%=keystrif%>"></input>
<input type="hidden" name="delete" value=""></input>  
Name: <input type="text" name="name" value="<%=interfc.getName()%>"></input><p>
Protocol : <select name="protocol"><option value="802.11a">802.11a</optional></select><p>
Direction :  <select name="direction"><option value="S">S</optional>
									 <option value="N">N</optional>
									 <option value="E">E</optional>
									 <option value="W">W</optional>
								     <option value="SE">SE</optional>
									 <option value="SW">SW</optional>
									 <option value="NE">NE</optional>
									 <option value="NW">NW</optional>
			</select><p>
<input type="submit" value="Save"/>
<input type='button' value='Cancel' onClick='self.close()'/>
</form>

<script>
function load() {
	var r=confirm("You want to delete the interface!");
	if (r==true) {
		document.location.href = "editinterface?delete=ok&keystrif=<%=keystrif%>"; 		
	}
}
</script>
</div>
</body>
</html>